package com.mazong.servershirobb.mapper;

import com.mazong.servershirobb.pojo.TbUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IDbSecurityMapper {
    // 根据用户名字获取用户信息
    @Select( "SELECT id,username,password FROM user WHERE username = #{username}" )
    TbUser getUserByName(@Param("username") String username);

    @Select("SELECT name FROM role WHERE id IN (SELECT role_id FROM user_role WHERE user_id=#{id})")
    List<String> getPermissionsById(@Param("id") Integer id);
}
